<?php
/**
*定义表单处理类（注册表单）
**/

namespace Fang\UserBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;

class Register extends AbstractType
{
	/**
	*表单构建函数
	**/
	public function buildForm(FormBuilderInterface $builder, array $options)
	{
		$builder->add("name", TextType::class, array(
		  "label" => "用户名",
	//	  "placeholder" => "请输入用户名",
		  "required" => true,
		))->add("password", RepeatedType::class, array(
		  "type" => PasswordType::class,
		  "invalid_message" => "两次输入的密码不一致",
		  "required" => true,
		  "first_options" => array("label"=>"密码"),
		  "second_options" => array("label"=>"确认密码"),
		));
		$builder->add("注册", SubmitType::class);
	}
}
